package com.com.base.util;

import com.com.base.bean.ResultMessage;

public class ResultMessageUtil {

    public static ResultMessage success() {
        return success("");
    }

    public static ResultMessage success(String message) {
        return success(message, null);
    }

    public static ResultMessage success(String message, Object data) {
        return get(1, "success", message, data);
    }

    public static ResultMessage error() {
        return error("");
    }

    public static ResultMessage error(String message) {
        return error(message, null);
    }

    public static ResultMessage error(String message, Object data) {
        return get(-1, "error", message, data);
    }

    public static ResultMessage get(int state, String code, String message, Object data) {
        ResultMessage resultMessage = new ResultMessage();
        resultMessage.setState(state);
        resultMessage.setCode(code);
        resultMessage.setMessage(message);
        resultMessage.setData(data);
        return resultMessage;
    }
}
